<template>
  <div class="app-container">
    <el-table :data="dataList" border>
      <el-table-column prop="channelName" label="通道名称" width="180"/>
      <el-table-column prop="channelCategory" label="通道类别" width="200"/>
      <el-table-column prop="total" align="center" label="总比数/成功笔数" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.total }} / {{ scope.row.successNum }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="totalAmount" align="center" label="充值金额" width="250">
        <template slot-scope="scope">
          <span>{{ '$' + $yun.formatAmount(scope.row.totalAmount)}} / {{ '$' + $yun.formatAmount(scope.row.successAmount)}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="successRate" label="成功率" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.successRate + '%' }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>

import {statistics} from "@/api/payment/payment";

export default {
  data() {
    return {
      dataList: [],
      loading: false,
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true
      statistics(this.queryParams).then(response => {
        this.dataList = response.data
        this.total = response.data.total
        this.loading = false
      })
    },
  },
}
</script>
